transitive[op] input-seq
transitive[op, max-steps] input-seq
Implements operators that are transitive.
max-steps is the max number of steps until the transitiveness "wears" off.
Most common example is the "is-a" operator
Say A is-a B, B is-a C, C is-a D, then A is-a B, C and D
Note that if the relation is "fuzzy" then transitive[] respects that too.
In which case we can use drop-below[] to decide when the transitiveness has worn off.
Note that an infinite loop is possible if the graph contains a loop,
so we try to check for that case.
Also, the result can potentially grow exponentially with each step,
so if that is possible in your use case, set max-steps to something managable.
For example, transitive[links-to] |starting web page>
could grow large very rapidly.